/**
 * 
 */
package com.locky.ws;

import java.awt.Image;
import java.util.Collection;

import javax.persistence.*;



import java.util.ArrayList;




/** 
 * @author ambroise
 */
@Entity
@Table(name="t_autorisation")
@NamedQueries(value={
		@NamedQuery(name="findAllAutorisations", query="select a from Autorisation a"),
		@NamedQuery(name="findAutorisationID", query="select b from Autorisation b where b.id=:param")
})
public class Autorisation {

	/**
	 * @uml.property  name="id"
	 */
	@Id
	private int id;

	/**
	 * Getter of the property <tt>id</tt>
	 * @return  Returns the id.
	 * @uml.property  name="id"
	 */
	public int getId() {
		return id;
	}

	/**
	 * Setter of the property <tt>id</tt>
	 * @param id  The id to set.
	 * @uml.property  name="id"
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @uml.property  name="nom"
	 */
	private String nom;

	/**
	 * Getter of the property <tt>nom</tt>
	 * @return  Returns the nom.
	 * @uml.property  name="nom"
	 */
	public String getNom() {
		return nom;
	}

	/**
	 * Setter of the property <tt>nom</tt>
	 * @param nom  The nom to set.
	 * @uml.property  name="nom"
	 */
	public void setNom(String nom) {
		this.nom = nom;
	}

	
	 

	/**
	 * @uml.property  name="description"
	 */
	private String description;

	/**
	 * Getter of the property <tt>description</tt>
	 * @return  Returns the description.
	 * @uml.property  name="description"
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Setter of the property <tt>description</tt>
	 * @param description  The description to set.
	 * @uml.property  name="description"
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/** 
	 * @uml.property name="users"
	 * @uml.associationEnd multiplicity="(0 -1)" ordering="true" inverse="autorisations:com.locky.ws.User"
	 */
	@ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE}, targetEntity = User.class)
	private ArrayList users = new ArrayList<User>();

	/** 
	 * Getter of the property <tt>users</tt>
	 * @return  Returns the users.
	 * @uml.property  name="users"
	 */
	public ArrayList getUsers() {
		return users;
	}

	/** 
	 * Setter of the property <tt>users</tt>
	 * @param users  The users to set.
	 * @uml.property  name="users"
	 */
	
	public void setUsers(ArrayList users) {
		this.users = users;
	}
	
	/**
	 * @uml.property  name="codeQR" multiplicity="(0 -1)" dimension="1"
	 */
	@Lob
	private byte[] codeQR;

	/**
	 * Getter of the property <tt>codeQR</tt>
	 * @return  Returns the codeQRs.
	 * @uml.property  name="codeQR"
	 */
	public byte[] getCodeQR() {
		return codeQR;
	}

	/**
	 * Setter of the property <tt>codeQR</tt>
	 * @param codeQR  The codeQRs to set.
	 * @uml.property  name="codeQR"
	 */
	public void setCodeQR(byte[] codeQR) {
		codeQR = codeQR;
	}

	/**
	 * @uml.property  name="jours"
	 * @uml.associationEnd  multiplicity="(0 -1)" ordering="true" inverse="autorisation:com.locky.ws.Jour"
	 */
	@OneToMany(mappedBy="autorisation", cascade=CascadeType.REMOVE,targetEntity=Jour.class)
	@JoinColumn(name="autorisation_fk")
	private ArrayList jours = new ArrayList<Jour>();

	/**
	 * Getter of the property <tt>jours</tt>
	 * @return  Returns the jours.
	 * @uml.property  name="jours"
	 */
	public ArrayList getJours() {
		return jours;
	}

	/**
	 * Setter of the property <tt>jours</tt>
	 * @param jours  The jours to set.
	 * @uml.property  name="jours"
	 */
	public void setJours(ArrayList jours) {
		this.jours = jours;
	}

	/**
	 * @uml.property  name="acces"
	 * @uml.associationEnd  inverse="autorisations:com.locky.ws.Acces"
	 */
	@ManyToOne
	private Acces acces;


	public Acces getAcces() {
		return acces;
	}

	/**
	 * Setter of the property <tt>acces</tt>
	 * @param acces    The acces to set.
	 * @uml.property    name="acces"
	 */
	public void setAcces(Acces acces) {
		this.acces = acces;
	}

		
		/**
		 */
		/*public Autorisation(int id, String name, String description){
			this.id=id;
			this.nom=name;
			this.description=description;
			this.acces=null;
			this.codeQR=null;
			this.jours=null;
			this.users=null;
					
		}*/

	/**
	 * @uml.property  name="acces"
	 * @uml.associationEnd  inverse="autorisations:com.locky.ws.Acces"
	 */

	

}
